package com.sys.sysserver.service.impl;

import com.sys.sysserver.domain.dto.UserLoginDTO;
import com.sys.sysserver.mapper.UserMapper;
import com.sys.sysserver.service.RegisterService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

@Service
@Slf4j
@RequiredArgsConstructor
public class RegisterServiceImpl implements RegisterService {
    private final UserMapper userMapper;

    @Override
    public void register(UserLoginDTO userLoginDTO) {
        String password = userLoginDTO.getPassword();
        password = DigestUtils.md5DigestAsHex(password.getBytes());
        userLoginDTO.setPassword(password);
        userMapper.registerUser(userLoginDTO);
    }
}
